package com.xdog.okx.config;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.web3j.protocol.Web3j;
import org.web3j.protocol.http.HttpService;

/**
 * Web3j配置类
 */
@Data
@Configuration
@ConfigurationProperties(prefix = "web3j")
public class Web3jConfig {

    /**
     * 区块链节点URL
     */
    private String clientAddress;

    /**
     * 创建Web3j实例
     *
     * @return Web3j实例
     */
    @Bean
    public Web3j web3j() {
        return Web3j.build(new HttpService(clientAddress));
    }
}